package cn.kgc.vue.utils;

import java.util.Random;

/**
 * @author 课工场
 * @date 2023/12/4
 * @description  秘钥工具类
 */
public class SaltUtil {

    private SaltUtil(){}

    public static String createSalt(Integer length){

        char[] charArray = "qwertyuiopasdfghjklzxcvbnm,.;1234567890QWERTYUIOPASDFGHJKLZXCVBNM".toCharArray();
        StringBuilder stringBuilder = new StringBuilder();
        Random random = new Random();
        for (Integer integer = 0; integer < length; integer++) {
            int index = random.nextInt(charArray.length);
           stringBuilder.append( charArray[index]);
        }

        return stringBuilder.toString();
    }

}
